import 'dart:async';

import 'plugin_image_platform_interface.dart';

class PluginImage {
  Future<String?> getPlatformVersion() {
    return PluginImagePlatform.instance.getPlatformVersion();
  }

  /// 访问相机
  Future openCamera() {
    return PluginImagePlatform.instance.openCamera();
  }

  /// 访问相册
  Future<Map?> openPhotoAlbum() {
    return PluginImagePlatform.instance.openPhotoAlbum();
  }

  /// 相机监听
  static StreamSubscription addListen(
    void Function(dynamic event)? onData, {
    Function? onError,
    void Function()? onDone,
    bool? cancelOnError,
  }) {
    return PluginImagePlatform.instance.deviceStream.listen(
      onData,
      onError: onError,
      onDone: onDone,
      cancelOnError: cancelOnError,
    );
  }
}
